#!/bin/sh

# Copyright 2011 Cooliris, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Get and populate variables (NAME, VERSION, REVISION).
SCRIPT_DIRECTORY=`dirname "$0"`
source "${SCRIPT_DIRECTORY}/GetBuildInfo.sh"

# Patch version header
PATH="${DERIVED_FILE_DIR}/${BUILD_INFO_HEADER_PATH}"

/bin/rm -f $PATH

echo "// This file is automatically generated by the build process." > $PATH
echo "// Do not edit or add to source control." >> $PATH
echo "#define kBuildInfoName \"${NAME}\"" >> $PATH
echo "#define kBuildInfoVersion ${VERSION}" >> $PATH
echo "#define kBuildInfoVersionAsString \"${VERSION}\"" >> $PATH
echo "#define kBuildInfoRevision ${REVISION}" >> $PATH
echo "#define kBuildInfoRevisionAsString \"${REVISION}\"" >> $PATH
echo "" >> $PATH
